package com.junglone.gateway.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpHeaders;
import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Description:
 *
 * @author junglone: <a href="mailto:cjlnzb@hotmail.com">cjlnzb@hotmail.com</a>
 * @since 2020/09/24 14:05
 */
@RestController
public class FilterTestController {

    private static final Logger LOGGER = LoggerFactory.getLogger(FilterTestController.class);

    @RequestMapping("/path")
    public String testPath() {

        LOGGER.info("test /path");

        return "test path";

    }

    @RequestMapping("/add-header")
    public String addHeader(ServerHttpRequest serverHttpRequest) {

        HttpHeaders headers = serverHttpRequest.getHeaders();

        LOGGER.info("test /add-header");
        LOGGER.info("headers ==== {}", headers);

        return "test add-header";

    }

}
